Check out my twitter script by CMXads
Sharp Stuff Switchblades Icepicks and german knives | Viking gear Gear Gifts and Apparel | PHP Gallery PHP Gallery is a free php image script. | Sell your soul Believeth in me an hath everlasting life |
here are some of the best and useful php scripts and snippets to help in your projects. Php displayed below. Use the search for specific script lookups. Click the category links to view scripts in Javascript and cgi. To add your own script click the link and add your useful script example.
check sum get data validation encoding and decoding get data and validate and validate tampering get data check security functions
encode decode validate get data check sum url
encode-decode-validate-get-data Added on 3-12-2014
<?php
$redirect='http://spamhaus.org';
$ipfile="ipBan.data";
if(!isset($_SESSION['Cksum'])){
makeCksum();
}
function makeCksum(){
$str = "";
for ($i=0;$i<32;++$i)
$str .= chr(rand(32,126));
$_SESSION['Cksum'] = $str;
}
//encode your get with saved to session
function encode($x) {
return strtr(base64_encode(substr($_SESSION['Cksum'],rand(0,28),4) . $x), '+/=', '-_~');
}
//decode get and validate
function decode($x) {
$y = base64_decode(strtr($x, '-_~', '+/='));
if (strpos($_SESSION['Cksum'],substr($y,0,4)) === false) return false;
return substr($y,4-strlen($y));
}
if(!decode($x)) {
$fp = fopen($ipfile, "a");
$canWrite = false;
while (!$canWrite) {
$canWrite = flock($fp, LOCK_EX);
}
fwrite($fp, "$ip\n");
fclose($fp);
echo "Success you have been banned.";
echo("<meta http-equiv=\"Refresh\" content=\"0;URL=$redirect\">");
exit();
}
?>